from django.shortcuts import render


# Create your views here.


def get_object(self):
    obj = get_object_or404(self.get_queryset(), pk=self.kwargs[pk])
    self.check_object_permissions(self.request, obj)
    return obj


from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView


class ExampleView(APIView):
    permission_classes = (IsAuthenticated,)

    def get(self, request, format=None):
        content = {
            'status': 'request was permitted'
        }
        return Response(content)

from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response

@api_view(['GET'])
@permission_classes((IsAuthenticated,))
def example_view(request, format=None):
    content = {
        'status':'request wad permitted'
    }
    return Response(content)